home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 2
/
CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso
/
magazine
/
amiga_e
/
epp
/
docs
/
pmodules
/
breadstr.doc
next >
Wrap
Text File
|
1980-01-05
|
1KB
|
27 lines
bReadString.e - Buffered read-string. This is about 100 million
times faster than ReadStr(), or the pmodule readStr(), but it
exacts its toll in complexity of use.
OBJECT DESCRIPTION:
~~~~~~~~~~~~~~~~~~~
OBJECT readDataType /* You need one of these for each file. */
fh : LONG /* := handle of file you have opened */
bufSize : LONG /* := inputBuffer size */
maxLineLength : LONG /* := StrMax() (may be dynamic to read */
/* in strings of different length.) */
inputBuffer : LONG /* create this with New() */
length : LONG /* num bytes read into inputBuffer */
pos : LONG /* next available char in inputBuffer */
ENDOBJECT
PROTOCOL FOR USE:
~~~~~~~~~~~~~~~~~
1. Create object, e.g.: DEF rd:readDataType
2. Open file with Open() and store filehandle in rd.fh
3. Allocate an estring of any length and assign the address to rd.inputBuffer
4. Assign the length of the buffer created in step 3 to rd.maxLineLength
5. Call bReadStr(), numbytes in rd.inputBuffer is returned.